import { FormItemType } from "@/components/GuatForm/types";
import { SignInPropertyMap as SIPM } from "@/map/attendance/sign-in/property-map";
import GuatSelectMember from "./duty/component/GuatSelectMember.vue";

export const searchFormItemConfig: FormItemType[] = [
  {
    label: "年级",
    field: "grade",
    component: "Select",
    options: [
      {
        label: "2020级",
        value: 2020,
      },
      {
        label: "2021级",
        value: 2021,
      },
      {
        label: "2022级",
        value: 2022,
      },
      {
        label: "2023级",
        value: 2023,
      },
    ],
  },
  {
    label: "学号",
    field: "no",
    component: "Input",
  },
];

export const newSignInFormItemConfig: FormItemType[] = [
  {
    label: "标题",
    field: SIPM.Title,
    component: "Input",
    required: true,
  },
  {
    label: "时间段",
    field: SIPM.StartTime,
    component: "RangePicker",
    required: true,
  },
  {
    label: "允许请假",
    field: SIPM.AllowLeave,
    component: "Switch",
    required: true,
  },
  {
    label: "成员列表",
    field: "memberList",
    required: true,
    render: (model) => {
      return (
        <GuatSelectMember
          selectedKeys={model.value.memberList}
          onUpdate:selectedKeys={(value) => (model.value.memberList = value)}
        />
      );
    },
  },
];

export const arrangeFormConfig: FormItemType[] = [
  {
    label: "姓名",
    field: "name",
  },
  {
    label: "学号",
    field: "no",
  },
  {
    label: "本学期已安排",
    field: "arrange",
  },
  {
    label: "日期范围",
    field: "dateRange",
    component: "RangePicker",
  },
];

export const newGroupFormConfig: FormItemType[] = [
  { label: "分组名称", field: "groupName", component: "Input" },
  {
    label: "是否启用",
    field: "groupStatus",
    component: "RadioGroup",
    options: [
      { label: "启用", value: 0 },
      { label: "禁用", value: 1 },
    ],
  },
  {
    label: "分组成员",
    field: "groupMembers",
    render: () => {
      return (
        <GuatSelectMember
          number={10}
          selectedKeys={[
            "2022070030101",
            "2022070030102",
            "2022070030103",
            "2022070030104",
            "2022070030105",
            "2022070030106",
            "2022070030107",
            "2022070030108",
            "2022070030109",
            "2022070030110",
          ]}
        />
      );
    },
  },
];
